/*
 * @Author: your name
 * @Date: 2021-12-01 08:39:52
 * @LastEditTime: 2021-12-01 10:56:03
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \esp8266-oled7240-arduino\src\key.cpp
 */






#include "key.h"
#include "Arduino.h"

void key_Init()
{
    pinMode(KEY1,INPUT_PULLUP);
}


uint8_t key_Scan(uint8_t mode)
{
	static uint8_t key_up=1;//按键按松开标志

	if(mode)key_up=1;  //支持连按		  
	if(key_up&&(GETK1==0))
	{
		delay(10);//去抖动
		key_up=0;
		if(GETK1==0)return KEY1_PRES;
	}else if(GETK1==1)key_up=1; 	    
 	return 0;// 无按键按下
}









